home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Sample Code / Snippets / Development Tools & Languages / MouseInfo 1.0.1 / UAppFrameAdorner.cp < prev    next >
Encoding:
Text File  |  1992-07-15  |  2.2 KB  |  93 lines  |  [TEXT/MPS ]

  1. //     Copyright © 1992 Apple Computer, Inc. All rights reserved.
  2. //     UAppFrameAdorner.cp
  3. //    Kent Sandvik DTS
  4. //    This file is used for specifying the TAppFrameAdorner member functions,
  5. //    Version Info (latest first):
  6. //
  7. //    <1>        khs        1.0        First final version
  8. //    <2>        khs        1.0.1    Fixed a memory leak in TMapApplication::GetSleepValue()
  9.  
  10.  
  11.  
  12. #ifndef __APPFRAMEADORNER__
  13. #include "UAppFrameAdorner.h"
  14. #endif
  15.  
  16.  
  17. //    Empty constructor - for avoiding ptabs in global data space
  18. #pragma segment ARes
  19. TAppFrameAdorner::TAppFrameAdorner()
  20. {
  21. }
  22.  
  23.  
  24. //    Draw TAppFrameAdorner Adorner method
  25. #pragma segment ARes
  26. pascal void TAppFrameAdorner::Draw(TView* itsView,
  27.                                    const VRect&    /*area*/)
  28. {
  29.     CRGBColor saveColor;
  30.     VRect adornArea;
  31.     CRect QDArea;
  32.     CRect tempRect;
  33.     CRGBColor anRGBGray;
  34.     RgnHandle outerRgn;
  35.     RgnHandle innerRgn;
  36.  
  37.  
  38.     PenNormal();
  39.  
  40.     itsView->GetAdornExtent(adornArea);
  41.     itsView->ViewToQDRect(adornArea, QDArea);
  42.     tempRect = QDArea;
  43.  
  44.     //     Build the region to use for filling, first create the outer region
  45.     InsetRect(QDArea, 1, 1);
  46.     outerRgn = NewRgn();
  47.     RectRgn(outerRgn, QDArea);
  48.  
  49.     //    Create the inner region
  50.     InsetRect(QDArea, 6, 6);
  51.     innerRgn = NewRgn();
  52.     RectRgn(innerRgn, QDArea);
  53.  
  54.     //    Finally subtract the inner from the outer region
  55.     DiffRgn(outerRgn, innerRgn, outerRgn);
  56.  
  57.     //    Get rid of the inner region
  58.     DisposeRgn(innerRgn);
  59.  
  60.     //    Set the foreground color to the global face color, this allows the user to
  61.     //    change the color of the face                                                                                                        
  62.     SetIfColor(gRGBLtGray);
  63.     PaintRgn(outerRgn);
  64.  
  65.     //    Get rid of the outer region
  66.     DisposeRgn(outerRgn);
  67.  
  68.     //    Draw the inside black frame
  69.     SetIfColor(gRGBBlack);
  70.     InsetRect(QDArea, 1, 1);
  71.     FrameRect(QDArea);
  72.  
  73.     //    Draw the shadows
  74.     {
  75.         //    Draw the outer gray shadow
  76.         SetIfColor(gRGBGray);
  77.         MoveTo(tempRect.left + 1, tempRect.bottom - 1);//(h, v)
  78.         LineTo(tempRect.right - 1, tempRect.bottom - 1);//(h, v)
  79.         LineTo(tempRect.right - 1, tempRect.top + 1);//(h, v)
  80.  
  81.         //    Draw the inner gray shadow    
  82.         SetIfColor(gRGBGray);
  83.         MoveTo(tempRect.left + 7, tempRect.bottom - 8);//(h, v)
  84.         LineTo(tempRect.left + 7, tempRect.top + 7);//(h, v)
  85.         LineTo(tempRect.right - 8, tempRect.top + 7);//(h, v)
  86.     }
  87.  
  88.     //    Restore the drawing environment
  89.     itsView->SetupDrawingEnvironment();
  90. }
  91.  
  92.  
  93.